package demo.practice.competition;

public class P5804 {
    public static void main(String[] args) {
        P5804 p5804 = new P5804();
        p5804.areOccurrencesEqual("abacbc");
    }

    public boolean areOccurrencesEqual(String s) {
        int[] b = new int[26];


        for (char c : s.toCharArray()) {
            b[c - 'a']++;
        }
        int count = -1;
        for (int i : b) {
            if (i != 0 && count == -1) {
                count = i;
            }

            if (i != 0 && count != -1 && count != i) {
                return false;
            }
        }

        return true;
    }
}
